package mainFunction;

import gui.MainFrame;
import gui.MainFrame.FrameListener;
import manager.MainManager;
import viewHelper4GUI.ChaView;
import viewHelper4GUI.DocView;
import viewHelper4GUI.PatView;
import viewHelper4GUI.TimView;

public class MainFunction {
	public static void main(String[] args) {
		MainManager manager = MainManager.getManager();
		MainFrame mainFrame = new MainFrame();
		mainFrame.addView(new ChaView(manager.getChaManager()));
		mainFrame.addView(new DocView(manager.getDocManager()));
		mainFrame.addView(new PatView(manager.getPatManager()));
		mainFrame.addView(new TimView(manager.getTimManager()));
		mainFrame.setVisible(true);
		mainFrame.setListener(new FrameListener() {
			
			@Override
			public void onStop() {
				manager.stop();
			}
			
			@Override
			public void onStart(int chairNum, int patNum, int docSkill) {
				manager.addChairs(chairNum);
				manager.addPatients(patNum);
				manager.setSkill(docSkill);
				manager.addDoctors(1);
				manager.startWork();
			}
			
			@Override
			public void onResume() {
				manager.resume();
			}
			
			@Override
			public void onPause() {
				manager.pauseWork();
			}
		});
	}
}
